package view.leeds;

import java.awt.Dimension;
import java.awt.event.ActionListener;

import javax.swing.JPanel;
import javax.swing.SpringLayout;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.JSeparator;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.JButton;
import java.awt.Font;
import javax.swing.DefaultComboBoxModel;

public class LeadHomeView extends JPanel
{
	private JTable table;
	private JButton btnSendMessage;
	private JButton btnSendMail;
	private JScrollPane tableCust;
	private JComboBox comboAttended;
	private JComboBox comboPriority;
	private JButton btnApplyFilter;
	private JLabel lblTo;
	private JLabel lblFrom;
	
	public LeadHomeView() 
	{
		SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		
		JLabel lblDate = new JLabel("DATE:");
		lblDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblDate, 30, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, lblDate, 30, SpringLayout.WEST, this);
		add(lblDate);
		
		lblTo = new JLabel("TO");
		lblTo.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblTo, 0, SpringLayout.NORTH, lblDate);
		springLayout.putConstraint(SpringLayout.WEST, lblTo, 39, SpringLayout.EAST, lblDate);
		springLayout.putConstraint(SpringLayout.EAST, lblTo, 61, SpringLayout.EAST, lblDate);
		add(lblTo);
		
		lblFrom = new JLabel("FROM");
		lblFrom.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblFrom, 0, SpringLayout.NORTH, lblDate);
		springLayout.putConstraint(SpringLayout.WEST, lblFrom, 61, SpringLayout.EAST, lblTo);
		add(lblFrom);
		
		JLabel lblAttendedBy = new JLabel("ATTENDED BY:");
		lblAttendedBy.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblAttendedBy, 30, SpringLayout.SOUTH, lblDate);
		springLayout.putConstraint(SpringLayout.WEST, lblAttendedBy, 30, SpringLayout.WEST, this);
		add(lblAttendedBy);
		
		comboAttended = new JComboBox();
		comboAttended.setModel(new DefaultComboBoxModel(new String[] {"--Select Attended By--"}));
		comboAttended.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, comboAttended, 6, SpringLayout.SOUTH, lblAttendedBy);
		springLayout.putConstraint(SpringLayout.WEST, comboAttended, 30, SpringLayout.WEST, this);
		add(comboAttended);
		comboAttended.setPreferredSize(new Dimension(250, 23));
		
		JLabel lblPriority = new JLabel("PRIORITY:");
		lblPriority.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblPriority, 0, SpringLayout.NORTH,lblAttendedBy);
		springLayout.putConstraint(SpringLayout.WEST, lblPriority, 30, SpringLayout.EAST,comboAttended);
		add(lblPriority);
		
		comboPriority = new JComboBox();
		comboPriority.setModel(new DefaultComboBoxModel(new String[] {"--Select Priority"}));
		comboPriority.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, comboPriority, 0, SpringLayout.NORTH, comboAttended);
		springLayout.putConstraint(SpringLayout.WEST, comboPriority, 30, SpringLayout.EAST,comboAttended);
		add(comboPriority);
		comboPriority.setPreferredSize(new Dimension(250, 23));
		
		btnApplyFilter = new JButton("APPLY FILTER");
		btnApplyFilter.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH,btnApplyFilter , 0, SpringLayout.NORTH,comboAttended);
		springLayout.putConstraint(SpringLayout.WEST, btnApplyFilter, 30, SpringLayout.EAST, comboPriority);
		add(btnApplyFilter);
		btnApplyFilter.setActionCommand("APPLY FILTER");
		
		btnSendMessage = new JButton("SEND MESSAGE");
		btnSendMessage.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.SOUTH, btnSendMessage, -30, SpringLayout.SOUTH,this);
		springLayout.putConstraint(SpringLayout.WEST, btnSendMessage, 30, SpringLayout.WEST, this);
		add(btnSendMessage);
		btnSendMessage.setActionCommand("SEND MESSAGE");
		
		btnSendMail = new JButton("SEND MAIL");
		btnSendMail.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.SOUTH, btnSendMail, -30, SpringLayout.SOUTH,this);
		springLayout.putConstraint(SpringLayout.WEST, btnSendMail, 50, SpringLayout.EAST, btnSendMessage);
		add(btnSendMail);
		btnSendMail.setActionCommand("SEND MAIL");
		
		tableCust = new JScrollPane();
		springLayout.putConstraint(SpringLayout.WEST, tableCust, 30, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.NORTH, tableCust,30, SpringLayout.SOUTH, btnApplyFilter);
		springLayout.putConstraint(SpringLayout.SOUTH, tableCust,-30, SpringLayout.NORTH,btnSendMessage);
		springLayout.putConstraint(SpringLayout.EAST, tableCust,-30, SpringLayout.EAST,this);
		add(tableCust);
		
		table = new JTable();
		table.setModel(new DefaultTableModel(
			new Object[][] {
			},
			new String[] {
				"Name", "PhoneNo", "Requirement", "Budget", "CheckBox"
			}
		) {
			boolean[] columnEditables = new boolean[] {
				false, false, false, false, true
			};
			public boolean isCellEditable(int row, int column) {
				return columnEditables[column];
			}
		});
		tableCust.setViewportView(table);
		
	}
	
	
	public JTable getTable() {
		return table;
	}
	public void setTable(JTable table) {
		this.table = table;
	}
	public JButton getBtnSendMessage() {
		return btnSendMessage;
	}
	public void setBtnSendMessage(JButton btnSendMessage) {
		this.btnSendMessage = btnSendMessage;
	}
	public JButton getBtnSendMail() {
		return btnSendMail;
	}
	public void setBtnSendMail(JButton btnSendMail) {
		this.btnSendMail = btnSendMail;
	}
	public JScrollPane getTableCust() {
		return tableCust;
	}
	public void setTableCust(JScrollPane tableCust) {
		this.tableCust = tableCust;
	}
	public JComboBox getComboAttended() {
		return comboAttended;
	}
	public void setComboAttended(JComboBox comboAttended) {
		this.comboAttended = comboAttended;
	}
	public JComboBox getComboPriority() {
		return comboPriority;
	}
	public void setComboPriority(JComboBox comboPriority) {
		this.comboPriority = comboPriority;
	}
	public JButton getBtnApplyFilter() {
		return btnApplyFilter;
	}
	public void setBtnApplyFilter(JButton btnApplyFilter) {
		this.btnApplyFilter = btnApplyFilter;
	}

	public JLabel getLblTo() {
		return lblTo;
	}

	public void setLblTo(JLabel lblTo) {
		this.lblTo = lblTo;
	}

	public JLabel getLblFrom() {
		return lblFrom;
	}

	public void setLblFrom(JLabel lblFrom) {
		this.lblFrom = lblFrom;
	}
	
	public void actionListener(ActionListener al)
	{
		btnApplyFilter.addActionListener(al);
		btnSendMail.addActionListener(al);
		btnSendMessage.addActionListener(al);
	}
	
	
	
}
